knitr::opts_chunk$set(echo = TRUE)

cmdstanr::set_cmdstan_path(path = "C:/Users/kueng/.cmdstan/cmdstan-2.35.0")


library(tidyverse)
library(R.utils)
library(wbCorr)
library(readxl)
library(kableExtra)
library(brms)
library(bayesplot)
library(beepr)
library(DHARMa)



source(file.path('Functions', 'ReportModels.R'))
source(file.path('Functions', 'PrettyTables.R'))
source(file.path('Functions', 'ReportMeasures.R'))
source(file.path('Functions', 'PrepareData.R'))
system("shutdown /a")
## [1] 1116
# Set options for analysis
use_mi = FALSE
shutdown = FALSE
report_ordinal = FALSE

options(
  dplyr.print_max = 100, 
  brms.backend = 'cmdstan',
  brms.file_refit = ifelse(use_mi, 'never', 'on_change'),
  brms.file_refit = 'on_change',
  #brms.file_refit = 'always',
  error = function() beepr::beep(sound = 5)
)



####################### Model parameters #######################

iterations = 5000
warmup = 2000
corstr = 'ar'
#corstr = 'cosy_couple'
#corstr = 'cosy_couple:user'


################################################################

if (corstr == 'ar') {
  autocor_str <- ~ ar(time = day, gr = coupleID:userID, p = 1)
  autocor_prior <- brms::set_prior("cauchy(0, 5)", class = "ar", lb = -1, ub = 1) 
  suffix = paste0('ar_', as.character(iterations))
} else if (corstr == 'cosy_couple') {
  autocor_str <- ~ cosy(gr = coupleID)
  autocor_prior <- brms::set_prior("cauchy(0, 5)", class = "cosy", lb = -1, ub = 1)
  suffix = paste0('cosy_couple_', as.character(iterations))
} else if (corstr == 'cosy_couple:user') {
  autocor_str <- ~ cosy(time = day, gr = coupleID:userID)
  autocor_prior <- brms::set_prior("cauchy(0, 5)", class = "cosy", lb = -1, ub = 1)
  suffix = paste0('cosy_couple:user_', as.character(iterations))
}
df <- openxlsx::read.xlsx(file.path('long.xlsx'))
df_original <- df

df_double <- prepare_data(df, recode_pushing = TRUE, use_mi = use_mi)[[1]]

Constructing scales Re-coding pusing reshaping data (4field) centering data within and between

Modelling

# For indistinguishable Dyads
model_rows_fixed <- c(
    'Intercept', 
    # '-- WITHIN PERSON MAIN EFFECTS --', 
    'persuasion_self_cw', 
    'persuasion_partner_cw', 
    'pressure_self_cw', 
    'pressure_partner_cw', 
    'pushing_self_cw', 
    'pushing_partner_cw', 
    'day', 
    'weartime_self_cw',
    
    # '-- BETWEEN PERSON MAIN EFFECTS',
    'persuasion_self_cb',
    'persuasion_partner_cb',
    'pressure_self_cb',
    'pressure_partner_cb',
    'pushing_self_cb',
    'pushing_partner_cb',
    'weartime_self_cb'
  )


model_rows_fixed_ordinal <- c(
  model_rows_fixed[1],
  'Intercept[1]',
  'Intercept[2]',
  'Intercept[3]',
  'Intercept[4]',
  'Intercept[5]',
  model_rows_fixed[2:length(model_rows_fixed)]
)

model_rows_random <- c(
  # '--------------',
  # '-- RANDOM EFFECTS --',
  'sd(Intercept)', 
  'sd(persuasion_self_cw)',
  'sd(persuasion_partner_cw)',
  'sd(pressure_self_cw)',
  'sd(pressure_partner_cw)',
  'sd(pushing_self_cw)',
  'sd(pushing_partner_cw)',
  # '-- CORRELATION STRUCTURE -- ', 
  'ar[1]', 
  'ma[1]', 
  'cosy',
  'nu',
  'shape',
  'sderr',
  'sigma'
)

model_rows_random_ordinal <- c(model_rows_random,'disc')
# For indistinguishable Dyads
model_rownames_fixed <- c(
    'Intercept', 
    # '-- WITHIN PERSON MAIN EFFECTS --', 
    'Daily received persuasion target -> target', 
    'Daily received persuasion target -> agent', 
    'Daily received pressure target -> target', 
    'Daily received pressure target -> agent', 
    'Daily received pushing target -> target', 
    'Daily received pushing target -> agent', 
    'Day', 
    'Daily weartime',
    
    # '-- BETWEEN PERSON MAIN EFFECTS',
    'Mean received persuasion target -> target',
    'Mean received persuasion target -> agent',
    'Mean received pressure target -> target',
    'Mean received pressure target -> agent',
    'Mean received pushing target -> target',
    'Mean received pushing target -> agent',
    'Mean weartime'
  )


model_rownames_fixed_ordinal <- c(
  model_rownames_fixed[1],
  'Intercept[1]',
  'Intercept[2]',
  'Intercept[3]',
  'Intercept[4]',
  'Intercept[5]',
  model_rownames_fixed[2:length(model_rownames_fixed)]
)

model_rownames_random <- c(
  # '--------------',
  # '-- RANDOM EFFECTS --',
  'sd(Intercept)', 
  'sd(Daily received persuasion target -> target)', 
  'sd(Daily received persuasion target -> agent)', 
  'sd(Daily received pressure target -> target)', 
  'sd(Daily received pressure target -> agent)', 
  'sd(Daily received pushing target -> target)', 
  'sd(Daily received pushing target -> agent)', 
  # '-- CORRELATION STRUCTURE -- ', 
  'ar[1]',
  'ma[1]', 
  'cosy',
  'nu',
  'shape',
  'sderr',
  'sigma'
)

model_rownames_random_ordinal <- c(model_rownames_random,'disc')
# For indistinguishable Dyads
model_rownames_fixed <- c(
    "Intercept", 
    # "-- WITHIN PERSON MAIN EFFECTS --", 
    "Daily persuasion experienced", 
    "Daily persuasion utilized (partner's view)", # OR partner received
    "Daily pressure experienced", 
    "Daily pressure utilized (partner's view)", 
    "Daily pushing experienced", 
    "Daily pushing utilized (partner's view)", 
    "Day", 
    "Daily weartime",
    
    # "-- BETWEEN PERSON MAIN EFFECTS",
    "Mean persuasion experienced", 
    "Mean persuasion utilized (partner's view)", 
    "Mean pressure experienced", 
    "Mean pressure utilized (partner's view)", 
    "Mean pushing experienced", 
    "Mean pushing utilized (partner's view)", 
    "Mean weartime"
  )


model_rownames_fixed_ordinal <- c(
  model_rownames_fixed[1],
  'Intercept[1]',
  'Intercept[2]',
  'Intercept[3]',
  'Intercept[4]',
  'Intercept[5]',
  model_rownames_fixed[2:length(model_rownames_fixed)]
)

model_rownames_random <- c(
  # '--------------',
  # '-- RANDOM EFFECTS --',
  'sd(Intercept)', 
  "sd(Daily persuasion experienced)", 
  "sd(Daily persuasion utilized (partner's view))", # OR partner received
  "sd(Daily pressure experienced)", 
  "sd(Daily pressure utilized (partner's view))", 
  "sd(Daily pushing experienced)", 
  "sd(Daily pushing utilized (partner's view))", 
  # '-- CORRELATION STRUCTURE -- ', 
  'ar[1]', 
  'ma[1]', 
  'cosy',
  'nu',
  'shape',
  'sderr',
  'sigma'
)

model_rownames_random_ordinal <- c(model_rownames_random,'disc')
rows_to_pack <- list(
  "Within-Person Effects" = c(2,9),
  "Between-Person Effects" = c(10,16),
  "Random Effects" = c(17, 23), 
  "Additional Parameters" = c(24,30)
  )


rows_to_pack_ordinal <- list(
  "Intercepts" = c(1,6),
  "Within-Person Effects" = c(2+5,9+5),
  "Between-Person Effects" = c(10+5,16+5),
  "Random Effects" = c(17+5, 23+5), 
  "Additional Parameters" = c(24+5,30+6)
  )

HURDLE MODELS

# For indistinguishable Dyads
model_rows_fixed_hu <- c(
    'Intercept', 
    'hu_Intercept',
    # '-- WITHIN PERSON MAIN EFFECTS --', 
    'persuasion_self_cw', 
    'persuasion_partner_cw', 
    'pressure_self_cw', 
    'pressure_partner_cw', 
    'pushing_self_cw', 
    'pushing_partner_cw', 
    'day', 
    'weartime_self_cw',
    
    # '-- BETWEEN PERSON MAIN EFFECTS',
    'persuasion_self_cb',
    'persuasion_partner_cb',
    'pressure_self_cb',
    'pressure_partner_cb',
    'pushing_self_cb',
    'pushing_partner_cb',
    'weartime_self_cb',
    
    # HURDLE MODEL
    # '-- WITHIN PERSON MAIN EFFECTS --', 
    'hu_persuasion_self_cw', 
    'hu_persuasion_partner_cw', 
    'hu_pressure_self_cw', 
    'hu_pressure_partner_cw', 
    'hu_pushing_self_cw', 
    'hu_pushing_partner_cw', 
    'hu_day', 
    'hu_weartime_self_cw',
    
    # '-- BETWEEN PERSON MAIN EFFECTS',
    'hu_persuasion_self_cb',
    'hu_persuasion_partner_cb',
    'hu_pressure_self_cb',
    'hu_pressure_partner_cb',
    'hu_pushing_self_cb',
    'hu_pushing_partner_cb',
    'hu_weartime_self_cb'
  )

model_rows_random_hu <- c(
  # '--------------',
  # '-- RANDOM EFFECTS --',
  'sd(Intercept)', 
  'sd(hu_Intercept)',
  'sd(persuasion_self_cw)',
  'sd(persuasion_partner_cw)',
  'sd(pressure_self_cw)',
  'sd(pressure_partner_cw)',
  'sd(pushing_self_cw)',
  'sd(pushing_partner_cw)',
  # HURDLE
  'sd(hu_persuasion_self_cw)',
  'sd(hu_persuasion_partner_cw)',
  'sd(hu_pressure_self_cw)',
  'sd(hu_pressure_partner_cw)',
  'sd(hu_pushing_self_cw)',
  'sd(hu_pushing_partner_cw)',
  # '-- CORRELATION STRUCTURE -- ', 
  'ar[1]', 
  'ma[1]', 
  'cosy',
  'nu',
  'shape',
  'sderr',
  'sigma'
)
# For indistinguishable Dyads
model_rownames_fixed_hu <- c(
    "Intercept", 
    "Hurdle Intercept",
    # "-- WITHIN PERSON MAIN EFFECTS --", 
    "Daily persuasion experienced", 
    "Daily persuasion utilized (partner's view)", # OR partner received
    "Daily pressure experienced", 
    "Daily pressure utilized (partner's view)", 
    "Daily pushing experienced", 
    "Daily pushing utilized (partner's view)", 
    "Day", 
    "Daily weartime",
    
    # "-- BETWEEN PERSON MAIN EFFECTS",
    "Mean persuasion experienced", 
    "Mean persuasion utilized (partner's view)", 
    "Mean pressure experienced", 
    "Mean pressure utilized (partner's view)", 
    "Mean pushing experienced", 
    "Mean pushing utilized (partner's view)", 
    "Mean weartime",
    
    # HURDLE
    # "-- WITHIN PERSON MAIN EFFECTS --", 
    "Hu Daily persuasion experienced", 
    "Hu Daily persuasion utilized (partner's view)", # OR partner received
    "Hu Daily pressure experienced", 
    "Hu Daily pressure utilized (partner's view)", 
    "Hu Daily pushing experienced", 
    "Hu Daily pushing utilized (partner's view)", 
    "Hu Day", 
    "Hu Daily weartime",
    
    # "-- BETWEEN PERSON MAIN EFFECTS",
    "Hu Mean persuasion experienced", 
    "Hu Mean persuasion utilized (partner's view)", 
    "Hu Mean pressure experienced", 
    "Hu Mean pressure utilized (partner's view)", 
    "Hu Mean pushing experienced", 
    "Hu Mean pushing utilized (partner's view)", 
    "Hu Mean weartime"
  )


model_rownames_random_hu <- c(
  # '--------------',
  # '-- RANDOM EFFECTS --',
  'sd(Intercept)', 
  'sd(Hurdle Intercept)', 
  "sd(Daily persuasion experienced)", 
  "sd(Daily persuasion utilized (partner's view))", # OR partner received
  "sd(Daily pressure experienced)", 
  "sd(Daily pressure utilized (partner's view))", 
  "sd(Daily pushing experienced)", 
  "sd(Daily pushing utilized (partner's view))", 
  
  # Hurdle
  "sd(Hu Daily persuasion experienced)", 
  "sd(Hu Daily persuasion utilized (partner's view))", # OR partner received
  "sd(Hu Daily pressure experienced)", 
  "sd(Hu Daily pressure utilized (partner's view))", 
  "sd(Hu Daily pushing experienced)", 
  "sd(Hu Daily pushing utilized (partner's view))", 
  # '-- CORRELATION STRUCTURE -- ', 
  'ar[1]', 
  'ma[1]', 
  'cosy',
  'nu',
  'shape',
  'sderr',
  'sigma'
)
rows_to_pack_hu <- list(
  "Conditional Within-Person Effects" = c(3,10),
  "Conditional Between-Person Effects" = c(11,17),
  
  "Hurdle Within-Person Effects" = c(18,25),
  "Hurdle Between-Person Effects" = c(26,32),
  
  "Random Effects" = c(33, 46), 
  "Additional Parameters" = c(47,53)
  )

Subjective MVPA

range(df_double$pa_sub, na.rm = T) 
## [1]   0 720
hist(df_double$pa_sub, breaks = 40) 

hist(log(df_double$pa_sub+00000000001), breaks = 40)

Hurdle Poisson Model

formula <- bf(
  pa_sub ~ 
    persuasion_self_cw + persuasion_partner_cw +
    pressure_self_cw + pressure_partner_cw +
    pushing_self_cw + pushing_partner_cw +
    
    persuasion_self_cb + persuasion_partner_cb +
    pressure_self_cb + pressure_partner_cb +
    pushing_self_cb + pushing_partner_cb +
    
    day + 
    
    # Random effects
    (1 + persuasion_self_cw + persuasion_partner_cw +
    pressure_self_cw + pressure_partner_cw +
    pushing_self_cw + pushing_partner_cw | coupleID),
  
  hu = ~ persuasion_self_cw + persuasion_partner_cw +
    pressure_self_cw + pressure_partner_cw +
    pushing_self_cw + pushing_partner_cw +
    
    persuasion_self_cb + persuasion_partner_cb +
    pressure_self_cb + pressure_partner_cb +
    pushing_self_cb + pushing_partner_cb +
    
    day + 
    
    # Random effects
    (1 + persuasion_self_cw + persuasion_partner_cw +
    pressure_self_cw + pressure_partner_cw +
    pushing_self_cw + pushing_partner_cw | coupleID)
  , autocor = autocor_str
) 

prior1 <- c(
  brms::set_prior("normal(0, 2.5)", class = "b")
  , brms::set_prior("normal(0, 50)", class = "Intercept") # for non-zero PA
  , brms::set_prior("normal(6, 2.5)", class = "Intercept", dpar = 'hu') # hurdle part
  
  , brms::set_prior("normal(0, 2)", class = "sd", group = "coupleID", lb = 0)
  
  #, brms::set_prior("normal(10, 10", class = "shape")
  
  #, brms::set_prior("cauchy(0, 2)", class = "sigma", lb = 0)
  , brms::set_prior("cauchy(0, 2)", class = "sderr", lb = 0)
  
  , autocor_prior
)

brms::validate_prior(
  prior1, 
  formula = formula, 
  data = df_double, 
  family = hurdle_poisson()
  )
## Warning: Rows containing NAs were excluded from the model.
#df_minimal <- df_double[, c("AorB", all.vars(as.formula(formula)))]

pa_sub <- my_brm(
  mi = use_mi, 
  imputed_data = implist,
  
  formula = formula, 
  prior = prior1,
  data = df_double, 
  #family = brms::hurdle_lognormal(), 
  #family = brms::hurdle_negbinomial(), 
  family = brms::hurdle_poisson(),
  control = list(adapt_delta = 0.95),
  iter = iterations,
  warmup = warmup,
  chains = 4,
  cores = 4,
  seed = 7777,
  file = file.path("models_cache_brms", paste0("pa_sub_hu_poisson_", suffix))
)
## Warning: Rows containing NAs were excluded from the model.
check_brms(pa_sub, log_pp_check = TRUE)
## 
## Divergences:
## 0 of 12000 iterations ended with a divergence.
## 
## Tree depth:
## 0 of 12000 iterations saturated the maximum tree depth of 10.
## 
## Energy:
## E-BFMI indicated no pathological behavior.

## Using 10 posterior draws for ppc type 'ecdf_overlay' by default.

## Using 10 posterior draws for ppc type 'dens_overlay' by default.

## Warning: Found 1672 observations with a pareto_k > 0.7 in model 'model'. We
## recommend to set 'moment_match = TRUE' in order to perform moment matching for
## problematic observations.
## 
## Computed from 12000 by 3736 log-likelihood matrix.
## 
##          Estimate     SE
## elpd_loo -32658.9  941.7
## p_loo     24314.6  853.7
## looic     65317.7 1883.5
## ------
## MCSE of elpd_loo is NA.
## MCSE and ESS estimates assume MCMC draws (r_eff in [0.4, 2.3]).
## 
## Pareto k diagnostic values:
##                          Count Pct.    Min. ESS
## (-Inf, 0.7]   (good)     2064  55.2%   461     
##    (0.7, 1]   (bad)        98   2.6%   <NA>    
##    (1, Inf)   (very bad) 1574  42.1%   <NA>    
## See help('pareto-k-diagnostic') for details.
DHARMa.check_brms.all(pa_sub, integer = TRUE)
## DHARMa:testOutliers with type = binomial may have inflated Type I error rates for integer-valued distributions. To get a more exact result, it is recommended to re-run testOutliers with type = 'bootstrap'. See ?testOutliers for details

## DHARMa:testOutliers with type = binomial may have inflated Type I error rates for integer-valued distributions. To get a more exact result, it is recommended to re-run testOutliers with type = 'bootstrap'. See ?testOutliers for details

## Object of Class DHARMa with simulated residuals based on 1000 simulations with refit = FALSE . See ?DHARMa::simulateResiduals for help. 
##  
## Scaled residual values: 0.3940511 1 0.02004498 0.308 0.5042459 0.925151 0.0009056866 0.4285656 0.6044282 0.5345751 0.9387669 0.1349345 0.5601726 1 0.4076557 0.9307523 0.3332225 0.3040894 0.09065378 0.998 ...
summarize_brms(
  pa_sub, 
  model_rows_fixed = model_rows_fixed_hu,
  model_rows_random = model_rows_random_hu,
  model_rownames_fixed = model_rownames_fixed_hu,
  model_rownames_random = model_rownames_random_hu,
  exponentiate = T,
  include_p_direction = T) %>%
  print_df(rows_to_pack = rows_to_pack_hu
)
## Warning in summarize_brms(pa_sub, model_rows_fixed = model_rows_fixed_hu, :
## Coefficients were exponentiated. Double check if this was intended.
exp(Est.) l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS p_direction
Intercept 48.82* 42.95 55.32 1.002 2631.97 4860.85 1
Hurdle Intercept 1.19 0.86 1.65 1.002 2447.79 5367.21 0.864
Conditional Within-Person Effects
Daily persuasion experienced 1.03 0.98 1.08 1.000 3873.02 6131.82 0.882
Daily persuasion utilized (partner’s view) 1.03 0.99 1.08 1.001 3448.17 5705.69 0.909
Daily pressure experienced 0.90* 0.82 0.99 1.000 3738.20 6032.04 0.98
Daily pressure utilized (partner’s view) 0.94 0.85 1.02 1.000 3797.25 5386.71 0.936
Daily pushing experienced 1.03 0.96 1.11 1.000 4416.62 6529.57 0.796
Daily pushing utilized (partner’s view) 0.99 0.93 1.06 1.001 3818.52 5967.44 0.56
Day 0.98 0.86 1.12 1.001 1900.30 3974.42 0.61
Daily weartime NA NA NA NA NA NA NA
Conditional Between-Person Effects
Mean persuasion experienced 1.03 0.75 1.42 1.001 2289.48 3858.10 0.577
Mean persuasion utilized (partner’s view) 1.02 0.74 1.39 1.001 2196.01 4213.69 0.539
Mean pressure experienced 1.09 0.75 1.57 1.001 2365.18 5282.43 0.677
Mean pressure utilized (partner’s view) 0.89 0.61 1.31 1.001 2776.35 5070.58 0.725
Mean pushing experienced 1.31 0.82 2.12 1.001 2771.56 4517.09 0.874
Mean pushing utilized (partner’s view) 1.31 0.81 2.14 1.001 2628.55 4641.10 0.862
Mean weartime NA NA NA NA NA NA NA
Hurdle Within-Person Effects
Hu Daily persuasion experienced 0.65* 0.57 0.73 1.001 10583.80 8967.97 1
Hu Daily persuasion utilized (partner’s view) 0.75* 0.67 0.84 1.000 11285.52 9314.41 1
Hu Daily pressure experienced 1.23 0.89 1.72 1.000 11630.87 9358.50 0.904
Hu Daily pressure utilized (partner’s view) 0.66* 0.43 0.95 1.000 9797.07 6380.89 0.987
Hu Daily pushing experienced 0.58* 0.40 0.78 1.000 9744.20 8381.38 1
Hu Daily pushing utilized (partner’s view) 0.54* 0.41 0.68 1.001 10961.44 8955.36 1
Hu Day 1.09 0.84 1.42 1.001 23427.12 8694.42 0.75
Hu Daily weartime NA NA NA NA NA NA NA
Hurdle Between-Person Effects
Hu Mean persuasion experienced 0.82 0.35 1.95 1.001 2043.52 4080.81 0.676
Hu Mean persuasion utilized (partner’s view) 0.83 0.36 1.95 1.001 2064.02 4271.06 0.668
Hu Mean pressure experienced 3.49* 1.40 8.69 1.000 3324.64 6122.70 0.996
Hu Mean pressure utilized (partner’s view) 1.84 0.74 4.54 1.001 3237.84 5819.30 0.904
Hu Mean pushing experienced 0.32 0.09 1.10 1.001 3339.43 5588.58 0.965
Hu Mean pushing utilized (partner’s view) 0.31 0.09 1.09 1.001 3358.06 5136.34 0.966
Hu Mean weartime NA NA NA NA NA NA NA
Random Effects
sd(Intercept) 0.31 0.24 0.41 1.00 2997.87 5058.08 NA
sd(Hurdle Intercept) 0.90 0.70 1.17 1.00 3564.02 5744.88 NA
sd(Daily persuasion experienced) 0.11 0.07 0.16 1.00 2668.43 4480.13 NA
sd(Daily persuasion utilized (partner’s view)) 0.08 0.04 0.13 1.00 2280.60 3048.95 NA
sd(Daily pressure experienced) 0.06 0.00 0.20 1.00 2887.46 4982.02 NA
sd(Daily pressure utilized (partner’s view)) 0.06 0.00 0.18 1.00 2709.88 5297.01 NA
sd(Daily pushing experienced) 0.12 0.06 0.20 1.00 2030.79 2407.90 NA
sd(Daily pushing utilized (partner’s view)) 0.11 0.04 0.18 1.00 1884.95 2419.13 NA
sd(Hu Daily persuasion experienced) 0.18 0.02 0.34 1.00 3860.73 3423.70 NA
sd(Hu Daily persuasion utilized (partner’s view)) 0.17 0.02 0.33 1.00 3691.94 3266.04 NA
sd(Hu Daily pressure experienced) 0.30 0.01 0.85 1.00 4749.58 6186.83 NA
sd(Hu Daily pressure utilized (partner’s view)) 0.35 0.01 1.02 1.00 4522.11 5369.01 NA
sd(Hu Daily pushing experienced) 0.65 0.33 1.08 1.00 6169.71 8308.81 NA
sd(Hu Daily pushing utilized (partner’s view)) 0.32 0.05 0.65 1.00 5399.56 4536.50 NA
Additional Parameters
ar[1] 0.35 0.27 0.42 1.01 823.84 1687.17 NA
ma[1] NA NA NA NA NA NA NA
cosy NA NA NA NA NA NA NA
nu NA NA NA NA NA NA NA
shape NA NA NA NA NA NA NA
sderr 0.62 0.60 0.65 1.00 2228.33 4497.83 NA
sigma NA NA NA NA NA NA NA

Additionally, as a sensitivity analysis, we estimate the two part of the models separately.

Two separate models

Modelling 0/1

The zero vs. 1 modelling part also has high pareto-k values, but reaches the same conslucsions as the hurdle model. We tried further simplifying by removing the residual AR1 correlation structure, which led to a model with good pareto-k values, still arriving at the same conslusion as the original hurdle model:

df_double$pa_sub_zero <- as.factor(ifelse(df_double$pa_sub > 0, 1, 0))

formula <- bf(
  pa_sub_zero ~ 
    persuasion_self_cw + persuasion_partner_cw +
    pressure_self_cw + pressure_partner_cw +
    pushing_self_cw + pushing_partner_cw +
    
    persuasion_self_cb + persuasion_partner_cb +
    pressure_self_cb + pressure_partner_cb +
    pushing_self_cb + pushing_partner_cb +
    
    day + 
    
    # Random effects
    (1 + persuasion_self_cw + persuasion_partner_cw +
    pressure_self_cw + pressure_partner_cw +
    pushing_self_cw + pushing_partner_cw | coupleID)
  , autocor = autocor_str
) 

prior1 <- c(
    set_prior("normal(0, 1.5)", class = "b")
  , brms::set_prior("normal(0, 5)", class = "Intercept") # for non-zero PA

  , brms::set_prior("normal(0, 1)", class = "sd", group = "coupleID")

  #, brms::set_prior("cauchy(0, 2)", class = "sigma", lb = 0)
  , brms::set_prior("cauchy(0, 1.5)", class = "sderr", lb = 0)
  
  , autocor_prior
)

brms::validate_prior(
  prior1, 
  formula = formula, 
  data = df_double, 
  family = bernoulli()
  )
## Warning: Rows containing NAs were excluded from the model.
pa_sub_zero_model <- my_brm(
  mi = use_mi, 
  imputed_data = implist,
  
  formula = formula, 
  prior = prior1,
  data = df_double, 
  #family = brms::hurdle_lognormal(), 
  #family = brms::hurdle_negbinomial(), 
  family = brms::bernoulli(),
  #control = list(adapt_delta = 0.95),
  iter = iterations,
  warmup = warmup,
  chains = 4,
  cores = 4,
  seed = 7777,
  file = file.path("models_cache_brms", paste0("pa_sub_hu_zero_part_", suffix))
)
## Warning: Rows containing NAs were excluded from the model.
check_brms(pa_sub_zero_model, log_pp_check = FALSE)
## 
## Divergences:
## 0 of 12000 iterations ended with a divergence.
## 
## Tree depth:
## 0 of 12000 iterations saturated the maximum tree depth of 10.
## 
## Energy:
## E-BFMI indicated possible pathological behavior:
##   Chain 1: E-BFMI = 0.116
##   Chain 2: E-BFMI = 0.119
##   Chain 3: E-BFMI = 0.116
##   Chain 4: E-BFMI = 0.076
## E-BFMI below 0.2 indicates you may need to reparameterize your model.

## Using 10 posterior draws for ppc type 'ecdf_overlay' by default.

## Using 10 posterior draws for ppc type 'dens_overlay' by default.

## Warning: Found 2902 observations with a pareto_k > 0.7 in model 'model'. We
## recommend to set 'moment_match = TRUE' in order to perform moment matching for
## problematic observations.
## 
## Computed from 12000 by 3736 log-likelihood matrix.
## 
##          Estimate   SE
## elpd_loo  -2057.8 26.4
## p_loo      1476.2 20.7
## looic      4115.7 52.9
## ------
## MCSE of elpd_loo is NA.
## MCSE and ESS estimates assume MCMC draws (r_eff in [0.2, 1.1]).
## 
## Pareto k diagnostic values:
##                          Count Pct.    Min. ESS
## (-Inf, 0.7]   (good)      834  22.3%   85      
##    (0.7, 1]   (bad)      2831  75.8%   <NA>    
##    (1, Inf)   (very bad)   71   1.9%   <NA>    
## See help('pareto-k-diagnostic') for details.
DHARMa.check_brms.all(pa_sub_zero_model, integer = TRUE)
## DHARMa:testOutliers with type = binomial may have inflated Type I error rates for integer-valued distributions. To get a more exact result, it is recommended to re-run testOutliers with type = 'bootstrap'. See ?testOutliers for details

## DHARMa:testOutliers with type = binomial may have inflated Type I error rates for integer-valued distributions. To get a more exact result, it is recommended to re-run testOutliers with type = 'bootstrap'. See ?testOutliers for details

## Object of Class DHARMa with simulated residuals based on 1000 simulations with refit = FALSE . See ?DHARMa::simulateResiduals for help. 
##  
## Scaled residual values: 0.0213891 0.7797575 0.1393801 0.8210585 0.2127832 0.9018039 0.1082542 0.3473051 0.1245918 0.5403571 0.9718155 0.03241736 0.2595172 0.8018681 0.1216559 0.9253531 0.6652438 0.04732755 0.04139307 0.9938304 ...
summarize_brms(
  pa_sub_zero_model, 
  model_rows_fixed = model_rows_fixed_hu,
  model_rows_random = model_rows_random_hu,
  model_rownames_fixed = model_rownames_fixed_hu,
  model_rownames_random = model_rownames_random_hu,
  exponentiate = T,
  include_p_direction = T) %>%
  print_df(rows_to_pack = rows_to_pack_hu
)
OR l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS p_direction
Intercept 0.62 0.23 1.44 1.001 2576.29 3656.39 0.868
Hurdle Intercept NA NA NA NA NA NA NA
Conditional Within-Person Effects
Daily persuasion experienced 3.35* 1.95 6.41 1.008 402.87 438.85 1
Daily persuasion utilized (partner’s view) 2.24* 1.50 3.79 1.006 524.94 774.82 1
Daily pressure experienced 0.60 0.26 1.26 1.001 5864.69 6540.76 0.918
Daily pressure utilized (partner’s view) 2.61* 1.15 7.06 1.002 2369.96 5136.62 0.99
Daily pushing experienced 3.98* 1.82 10.25 1.004 930.07 2155.85 1
Daily pushing utilized (partner’s view) 4.96* 2.34 12.41 1.005 566.50 675.59 1
Day 0.75 0.34 1.63 1.001 7367.65 5743.08 0.765
Daily weartime NA NA NA NA NA NA NA
Conditional Between-Person Effects
Mean persuasion experienced 1.05 0.26 4.25 1.001 5765.12 8153.08 0.53
Mean persuasion utilized (partner’s view) 1.12 0.27 4.55 1.001 5271.18 7103.29 0.566
Mean pressure experienced 0.15* 0.03 0.81 1.001 6347.69 8691.03 0.986
Mean pressure utilized (partner’s view) 0.42 0.07 2.30 1.000 7858.56 8915.32 0.84
Mean pushing experienced 2.75 0.37 19.84 1.000 7566.78 8009.49 0.847
Mean pushing utilized (partner’s view) 3.52 0.47 25.39 1.001 7866.12 8204.64 0.896
Mean weartime NA NA NA NA NA NA NA
Hurdle Within-Person Effects
Hu Daily persuasion experienced NA NA NA NA NA NA NA
Hu Daily persuasion utilized (partner’s view) NA NA NA NA NA NA NA
Hu Daily pressure experienced NA NA NA NA NA NA NA
Hu Daily pressure utilized (partner’s view) NA NA NA NA NA NA NA
Hu Daily pushing experienced NA NA NA NA NA NA NA
Hu Daily pushing utilized (partner’s view) NA NA NA NA NA NA NA
Hu Day NA NA NA NA NA NA NA
Hu Daily weartime NA NA NA NA NA NA NA
Hurdle Between-Person Effects
Hu Mean persuasion experienced NA NA NA NA NA NA NA
Hu Mean persuasion utilized (partner’s view) NA NA NA NA NA NA NA
Hu Mean pressure experienced NA NA NA NA NA NA NA
Hu Mean pressure utilized (partner’s view) NA NA NA NA NA NA NA
Hu Mean pushing experienced NA NA NA NA NA NA NA
Hu Mean pushing utilized (partner’s view) NA NA NA NA NA NA NA
Hu Mean weartime NA NA NA NA NA NA NA
Random Effects
sd(Intercept) 2.36 1.38 3.43 1.01 373.40 354.70 NA
sd(Hurdle Intercept) NA NA NA NA NA NA NA
sd(Daily persuasion experienced) 0.53 0.13 1.02 1.00 1057.11 2776.48 NA
sd(Daily persuasion utilized (partner’s view)) 0.45 0.07 0.95 1.00 1413.61 3342.24 NA
sd(Daily pressure experienced) 0.52 0.02 1.52 1.00 4168.48 6456.94 NA
sd(Daily pressure utilized (partner’s view)) 0.57 0.02 1.60 1.00 4966.37 6354.18 NA
sd(Daily pushing experienced) 1.39 0.65 2.34 1.00 1073.00 1780.11 NA
sd(Daily pushing utilized (partner’s view)) 0.73 0.12 1.50 1.00 2019.92 4063.32 NA
sd(Hu Daily persuasion experienced) NA NA NA NA NA NA NA
sd(Hu Daily persuasion utilized (partner’s view)) NA NA NA NA NA NA NA
sd(Hu Daily pressure experienced) NA NA NA NA NA NA NA
sd(Hu Daily pressure utilized (partner’s view)) NA NA NA NA NA NA NA
sd(Hu Daily pushing experienced) NA NA NA NA NA NA NA
sd(Hu Daily pushing utilized (partner’s view)) NA NA NA NA NA NA NA
Additional Parameters
ar[1] 0.10 0.03 0.18 1.00 1496.29 1121.45 NA
ma[1] NA NA NA NA NA NA NA
cosy NA NA NA NA NA NA NA
nu NA NA NA NA NA NA NA
shape NA NA NA NA NA NA NA
sderr 4.47 2.33 6.70 1.01 298.19 288.12 NA
sigma NA NA NA NA NA NA NA

Modelling active Days

# Only include active days
df_double$pa_sub_non_zero <- ifelse(df_double$pa_sub > 0, df_double$pa_sub, NA)

formula <- bf(
  log(pa_sub_non_zero) ~ 
    persuasion_self_cw + persuasion_partner_cw +
    pressure_self_cw + pressure_partner_cw +
    pushing_self_cw + pushing_partner_cw +
    
    persuasion_self_cb + persuasion_partner_cb +
    pressure_self_cb + pressure_partner_cb +
    pushing_self_cb + pushing_partner_cb +
    
    day + 
    
    # Random effects
    (1 + persuasion_self_cw + persuasion_partner_cw +
    pressure_self_cw + pressure_partner_cw +
    pushing_self_cw + pushing_partner_cw | coupleID)
  , autocor = autocor_str
) 

prior1 <- c(
  brms::set_prior("normal(0, 2.5)", class = "b")
  , brms::set_prior("normal(0, 50)", class = "Intercept") # for non-zero PA

  , brms::set_prior("normal(0, 2)", class = "sd", group = "coupleID", lb = 0)
  
  , brms::set_prior("cauchy(0, 2)", class = "sigma", lb = 0)
  #, brms::set_prior("cauchy(0, 2)", class = "sderr", lb = 0)
  
  , autocor_prior
)

brms::validate_prior(
  prior1, 
  formula = formula, 
  data = df_double, 
  family = gaussian()
  )
## Warning: Rows containing NAs were excluded from the model.
pa_sub_active_model <- my_brm(
  mi = use_mi, 
  imputed_data = implist,
  
  formula = formula, 
  prior = prior1,
  data = df_double, 
  family = gaussian(),
  #control = list(adapt_delta = 0.95),
  iter = iterations,
  warmup = warmup,
  chains = 4,
  cores = 4,
  seed = 7777,
  file = file.path("models_cache_brms", paste0("pa_sub_hu_active_part_", suffix))
)
## Warning: Rows containing NAs were excluded from the model.
check_brms(pa_sub_active_model, log_pp_check = TRUE)
## 
## Divergences:
## 0 of 12000 iterations ended with a divergence.
## 
## Tree depth:
## 0 of 12000 iterations saturated the maximum tree depth of 10.
## 
## Energy:
## E-BFMI indicated no pathological behavior.

## Using 10 posterior draws for ppc type 'ecdf_overlay' by default.

## Using 10 posterior draws for ppc type 'dens_overlay' by default.

## 
## Computed from 12000 by 1672 log-likelihood matrix.
## 
##          Estimate   SE
## elpd_loo  -1747.4 34.5
## p_loo        86.1  4.4
## looic      3494.9 68.9
## ------
## MCSE of elpd_loo is 0.1.
## MCSE and ESS estimates assume MCMC draws (r_eff in [0.5, 2.2]).
## 
## All Pareto k estimates are good (k < 0.7).
## See help('pareto-k-diagnostic') for details.
DHARMa.check_brms.all(pa_sub_active_model, integer = TRUE)
## DHARMa:testOutliers with type = binomial may have inflated Type I error rates for integer-valued distributions. To get a more exact result, it is recommended to re-run testOutliers with type = 'bootstrap'. See ?testOutliers for details

## DHARMa:testOutliers with type = binomial may have inflated Type I error rates for integer-valued distributions. To get a more exact result, it is recommended to re-run testOutliers with type = 'bootstrap'. See ?testOutliers for details

## Object of Class DHARMa with simulated residuals based on 1000 simulations with refit = FALSE . See ?DHARMa::simulateResiduals for help. 
##  
## Scaled residual values: 0.898 0.448 0.784 0.753 0.819 0.772 0.774 0.984 0.585 0.56 0.656 0.542 0.493 0.881 0.565 0.486 0.856 0.937 0.546 0.513 ...
summarize_brms(
  pa_sub_active_model, 
  model_rows_fixed = model_rows_fixed_hu,
  model_rows_random = model_rows_random_hu,
  model_rownames_fixed = model_rownames_fixed_hu,
  model_rownames_random = model_rownames_random_hu,
  exponentiate = T,
  include_p_direction = T) %>%
  print_df(rows_to_pack = rows_to_pack_hu
)
## Warning in summarize_brms(pa_sub_active_model, model_rows_fixed =
## model_rows_fixed_hu, : Coefficients were exponentiated. Double check if this
## was intended.
exp(Est.) l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS p_direction
Intercept 47.77* 41.82 54.56 1.000 7023.82 8472.15 1
Hurdle Intercept NA NA NA NA NA NA NA
Conditional Within-Person Effects
Daily persuasion experienced 1.04 0.99 1.08 1.000 9903.20 9571.80 0.933
Daily persuasion utilized (partner’s view) 1.03 0.99 1.08 1.000 12037.33 9370.34 0.93
Daily pressure experienced 0.89* 0.81 0.98 1.000 17840.57 9557.74 0.992
Daily pressure utilized (partner’s view) 0.94 0.85 1.02 1.000 16791.13 9889.03 0.936
Daily pushing experienced 1.04 0.97 1.12 1.000 11922.01 9012.74 0.87
Daily pushing utilized (partner’s view) 1.01 0.94 1.07 1.000 14404.47 9474.01 0.576
Day 1.02 0.87 1.18 1.000 25305.89 9392.14 0.583
Daily weartime NA NA NA NA NA NA NA
Conditional Between-Person Effects
Mean persuasion experienced 0.99 0.71 1.38 1.001 5839.03 7765.92 0.53
Mean persuasion utilized (partner’s view) 0.98 0.71 1.37 1.001 5976.24 7889.03 0.535
Mean pressure experienced 1.13 0.76 1.69 1.001 8780.57 8775.44 0.727
Mean pressure utilized (partner’s view) 0.93 0.61 1.42 1.001 9189.17 8896.74 0.642
Mean pushing experienced 1.37 0.84 2.23 1.001 8181.05 9019.15 0.895
Mean pushing utilized (partner’s view) 1.37 0.82 2.27 1.001 8138.85 9046.79 0.886
Mean weartime NA NA NA NA NA NA NA
Hurdle Within-Person Effects
Hu Daily persuasion experienced NA NA NA NA NA NA NA
Hu Daily persuasion utilized (partner’s view) NA NA NA NA NA NA NA
Hu Daily pressure experienced NA NA NA NA NA NA NA
Hu Daily pressure utilized (partner’s view) NA NA NA NA NA NA NA
Hu Daily pushing experienced NA NA NA NA NA NA NA
Hu Daily pushing utilized (partner’s view) NA NA NA NA NA NA NA
Hu Day NA NA NA NA NA NA NA
Hu Daily weartime NA NA NA NA NA NA NA
Hurdle Between-Person Effects
Hu Mean persuasion experienced NA NA NA NA NA NA NA
Hu Mean persuasion utilized (partner’s view) NA NA NA NA NA NA NA
Hu Mean pressure experienced NA NA NA NA NA NA NA
Hu Mean pressure utilized (partner’s view) NA NA NA NA NA NA NA
Hu Mean pushing experienced NA NA NA NA NA NA NA
Hu Mean pushing utilized (partner’s view) NA NA NA NA NA NA NA
Hu Mean weartime NA NA NA NA NA NA NA
Random Effects
sd(Intercept) 0.30 0.22 0.41 1.00 5277.01 8286.18 NA
sd(Hurdle Intercept) NA NA NA NA NA NA NA
sd(Daily persuasion experienced) 0.09 0.05 0.14 1.00 6603.77 8505.36 NA
sd(Daily persuasion utilized (partner’s view)) 0.07 0.03 0.12 1.00 7423.48 7297.18 NA
sd(Daily pressure experienced) 0.07 0.00 0.20 1.00 7196.67 7438.40 NA
sd(Daily pressure utilized (partner’s view)) 0.07 0.00 0.18 1.00 6931.92 6127.56 NA
sd(Daily pushing experienced) 0.12 0.06 0.20 1.00 7449.63 7982.79 NA
sd(Daily pushing utilized (partner’s view)) 0.09 0.02 0.16 1.00 5140.93 4154.30 NA
sd(Hu Daily persuasion experienced) NA NA NA NA NA NA NA
sd(Hu Daily persuasion utilized (partner’s view)) NA NA NA NA NA NA NA
sd(Hu Daily pressure experienced) NA NA NA NA NA NA NA
sd(Hu Daily pressure utilized (partner’s view)) NA NA NA NA NA NA NA
sd(Hu Daily pushing experienced) NA NA NA NA NA NA NA
sd(Hu Daily pushing utilized (partner’s view)) NA NA NA NA NA NA NA
Additional Parameters
ar[1] 0.29 0.24 0.34 1.00 18446.03 9306.28 NA
ma[1] NA NA NA NA NA NA NA
cosy NA NA NA NA NA NA NA
nu NA NA NA NA NA NA NA
shape NA NA NA NA NA NA NA
sderr NA NA NA NA NA NA NA
sigma 0.67 0.65 0.69 1.00 21440.38 9034.57 NA

Device Based MVPA

range(df_double$pa_obj, na.rm = T) 
## [1]   5.75 971.25
hist(df_double$pa_obj, breaks = 50)

df_double$pa_obj_log <- log(df_double$pa_obj)

hist(df_double$pa_obj_log, breaks = 50)

log gaussian

formula <- bf(
  log(pa_obj) ~ 
    persuasion_self_cw + persuasion_partner_cw +
    pressure_self_cw + pressure_partner_cw +
    pushing_self_cw + pushing_partner_cw +
    
    persuasion_self_cb + persuasion_partner_cb +
    pressure_self_cb + pressure_partner_cb +
    pushing_self_cb + pushing_partner_cb +
    
    day + weartime_self_cw + weartime_self_cb +
    
    # Random effects
    (persuasion_self_cw + persuasion_partner_cw +
    pressure_self_cw + pressure_partner_cw +
    pushing_self_cw + pushing_partner_cw | coupleID)
  , autocor = autocor_str
)



prior1 <- c(
  brms::set_prior("normal(0, 2.5)", class = "b")
  , brms::set_prior("normal(0, 50)", class = "Intercept") # for non-zero PA

  , brms::set_prior("normal(0, 2)", class = "sd", group = "coupleID", lb = 0)
  
  , brms::set_prior("cauchy(0, 2)", class = "sigma", lb = 0)
  #, brms::set_prior("cauchy(0, 2)", class = "sderr", lb = 0)
  
  , autocor_prior
)

brms::validate_prior(
  prior1, 
  formula = formula, 
  data = df_double, 
  family = gaussian()
  )
## Warning: Rows containing NAs were excluded from the model.
#df_minimal <- df_double[, c("AorB", all.vars(as.formula(formula)))]

pa_obj_log <- my_brm(
  mi = use_mi, 
  imputed_data = implist,
  
  formula = formula, 
  prior = prior1,
  data = df_double, 
  family = gaussian(),
  #control = list(adapt_delta = 0.95),
  iter = iterations,
  warmup = warmup,
  chains = 4,
  cores = 4,
  seed = 7777,
  file = file.path("models_cache_brms", paste0("pa_obj_log_gaussian_", suffix))
)
## Warning: Rows containing NAs were excluded from the model.
check_brms(pa_obj_log, log_pp_check = TRUE)
## 
## Divergences:
## 0 of 12000 iterations ended with a divergence.
## 
## Tree depth:
## 0 of 12000 iterations saturated the maximum tree depth of 10.
## 
## Energy:
## E-BFMI indicated no pathological behavior.

## Using 10 posterior draws for ppc type 'ecdf_overlay' by default.

## Using 10 posterior draws for ppc type 'dens_overlay' by default.

## 
## Computed from 12000 by 3337 log-likelihood matrix.
## 
##          Estimate    SE
## elpd_loo  -2813.8  56.5
## p_loo        91.6   4.6
## looic      5627.6 113.0
## ------
## MCSE of elpd_loo is 0.1.
## MCSE and ESS estimates assume MCMC draws (r_eff in [0.3, 1.7]).
## 
## All Pareto k estimates are good (k < 0.7).
## See help('pareto-k-diagnostic') for details.
DHARMa.check_brms.all(pa_obj_log, integer = TRUE)
## DHARMa:testOutliers with type = binomial may have inflated Type I error rates for integer-valued distributions. To get a more exact result, it is recommended to re-run testOutliers with type = 'bootstrap'. See ?testOutliers for details

## DHARMa:testOutliers with type = binomial may have inflated Type I error rates for integer-valued distributions. To get a more exact result, it is recommended to re-run testOutliers with type = 'bootstrap'. See ?testOutliers for details

## Object of Class DHARMa with simulated residuals based on 1000 simulations with refit = FALSE . See ?DHARMa::simulateResiduals for help. 
##  
## Scaled residual values: 0.379 0.677 0.011 0.118 0.106 0.568 0.206 0.574 0.267 0.296 0.761 0.514 0.395 0.524 0.086 0.381 0.398 0.255 0.395 0.729 ...
summarize_brms(
  pa_obj_log, 
  model_rows_fixed = model_rows_fixed,
  model_rows_random = model_rows_random,
  model_rownames_fixed = model_rownames_fixed,
  model_rownames_random = model_rownames_random,
  exponentiate = T,
  include_p_direction = T) %>%
  print_df(rows_to_pack = rows_to_pack)
## Warning in summarize_brms(pa_obj_log, model_rows_fixed = model_rows_fixed, :
## Coefficients were exponentiated. Double check if this was intended.
exp(Est.) l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS p_direction
Intercept 117.92* 105.70 131.58 1.000 3121.13 5697.81 1
Within-Person Effects
Daily persuasion experienced 1.03 1.00 1.06 1.000 8124.19 8894.78 0.958
Daily persuasion utilized (partner’s view) 1.02 0.99 1.05 1.000 10231.49 8773.49 0.878
Daily pressure experienced 0.95 0.89 1.01 1.001 12898.90 8806.28 0.953
Daily pressure utilized (partner’s view) 0.98 0.92 1.04 1.000 13958.09 8679.13 0.731
Daily pushing experienced 1.03 0.98 1.07 1.000 9673.48 7604.96 0.881
Daily pushing utilized (partner’s view) 1.03 0.99 1.07 1.000 13420.04 8709.55 0.943
Day 0.96 0.88 1.05 1.000 16584.01 8216.44 0.817
Daily weartime 1.00* 1.00 1.00 1.001 11954.84 7895.70 1
Between-Person Effects
Mean persuasion experienced 1.09 0.82 1.45 1.001 2669.09 4389.54 0.72
Mean persuasion utilized (partner’s view) 0.96 0.71 1.29 1.002 2642.26 4329.30 0.591
Mean pressure experienced 0.97 0.71 1.34 1.001 4130.93 6947.20 0.584
Mean pressure utilized (partner’s view) 0.98 0.72 1.33 1.001 4031.90 6870.09 0.56
Mean pushing experienced 1.01 0.66 1.54 1.001 4026.01 5657.99 0.518
Mean pushing utilized (partner’s view) 1.29 0.85 1.96 1.001 4011.26 6538.24 0.886
Mean weartime 1.00 1.00 1.00 1.001 11714.34 9448.27 0.836
Random Effects
sd(Intercept) 0.30 0.23 0.39 1.00 3616.86 6285.29 NA
sd(Daily persuasion experienced) 0.05 0.03 0.08 1.00 6572.95 6506.41 NA
sd(Daily persuasion utilized (partner’s view)) 0.05 0.02 0.08 1.00 5974.21 5245.51 NA
sd(Daily pressure experienced) 0.04 0.00 0.13 1.00 5894.74 5871.09 NA
sd(Daily pressure utilized (partner’s view)) 0.04 0.00 0.11 1.00 5855.56 5363.44 NA
sd(Daily pushing experienced) 0.06 0.00 0.14 1.00 2348.35 4924.03 NA
sd(Daily pushing utilized (partner’s view)) 0.03 0.00 0.08 1.00 4996.80 6091.79 NA
Additional Parameters
ar[1] 0.29 0.26 0.33 1.00 17999.27 8503.02 NA
ma[1] NA NA NA NA NA NA NA
cosy NA NA NA NA NA NA NA
nu NA NA NA NA NA NA NA
shape NA NA NA NA NA NA NA
sderr NA NA NA NA NA NA NA
sigma 0.55 0.54 0.57 1.00 16959.11 9077.14 NA

Affect

range(df_double$aff, na.rm = T) 
## [1] 0 5
hist(df_double$aff, breaks = 15)

Gaussian

formula <- bf(
  aff ~ 
    persuasion_self_cw + persuasion_partner_cw +
    pressure_self_cw + pressure_partner_cw +
    pushing_self_cw + pushing_partner_cw +
    
    persuasion_self_cb + persuasion_partner_cb +
    pressure_self_cb + pressure_partner_cb +
    pushing_self_cb + pushing_partner_cb +
    
    day +
    
    # Random effects
    (persuasion_self_cw + persuasion_partner_cw +
    pressure_self_cw + pressure_partner_cw +
    pushing_self_cw + pushing_partner_cw | coupleID)
  , autocor = autocor_str
)


prior1 <- c(
  brms::set_prior("normal(0, 5)", class = "b")
  ,brms::set_prior("normal(0, 20)", class = "Intercept", lb=1, ub=6) # range of the outcome scale
  
  , brms::set_prior("normal(0, 2)", class = "sd", group = "coupleID", lb = 0)
  
  , brms::set_prior("cauchy(0, 2)", class = "sigma", lb = 0)
  #, brms::set_prior("cauchy(0, 2)", class = "sderr", lb = 0)
  
  , autocor_prior
)

brms::validate_prior(
  prior1, 
  formula = formula, 
  data = df_double, 
  family = gaussian()
  )
## Warning: Rows containing NAs were excluded from the model.
#df_minimal <- df_double[, c("AorB", all.vars(as.formula(formula)))]

mood_gauss <- my_brm(
  mi = use_mi, 
  imputed_data = implist,
  
  formula = formula, 
  prior = prior1,
  data = df_double, 
  family = gaussian(),
  #control = list(adapt_delta = 0.95, max_treedepth = 15),
  iter = iterations,
  warmup = warmup,
  chains = 4,
  cores = 4,
  seed = 7777,
  file = file.path("models_cache_brms", paste0("mood_gauss_", suffix))
)
## Warning: Rows containing NAs were excluded from the model.
check_brms(mood_gauss, log_pp_check = FALSE)
## 
## Divergences:
## 0 of 12000 iterations ended with a divergence.
## 
## Tree depth:
## 0 of 12000 iterations saturated the maximum tree depth of 10.
## 
## Energy:
## E-BFMI indicated no pathological behavior.

## Using 10 posterior draws for ppc type 'ecdf_overlay' by default.

## Using 10 posterior draws for ppc type 'dens_overlay' by default.

## Warning: Found 1 observations with a pareto_k > 0.7 in model 'model'. We
## recommend to set 'moment_match = TRUE' in order to perform moment matching for
## problematic observations.
## 
## Computed from 12000 by 3736 log-likelihood matrix.
## 
##          Estimate    SE
## elpd_loo  -4816.5  63.5
## p_loo        89.9   4.6
## looic      9633.1 127.1
## ------
## MCSE of elpd_loo is NA.
## MCSE and ESS estimates assume MCMC draws (r_eff in [0.5, 1.8]).
## 
## Pareto k diagnostic values:
##                          Count Pct.    Min. ESS
## (-Inf, 0.7]   (good)     3735  100.0%  1040    
##    (0.7, 1]   (bad)         1    0.0%  <NA>    
##    (1, Inf)   (very bad)    0    0.0%  <NA>    
## See help('pareto-k-diagnostic') for details.
DHARMa.check_brms.all(mood_gauss, integer = FALSE)

## Object of Class DHARMa with simulated residuals based on 1000 simulations with refit = FALSE . See ?DHARMa::simulateResiduals for help. 
##  
## Scaled residual values: 0.504 0.804 0.261 0.971 0.295 0.576 0.358 0.331 0.373 0.468 0.607 0.056 0.657 0.828 0.443 0.496 0.785 0.76 0.629 0.485 ...
summarize_brms(
  mood_gauss, 
  model_rows_fixed = model_rows_fixed,
  model_rows_random = model_rows_random,
  model_rownames_fixed = model_rownames_fixed,
  model_rownames_random = model_rownames_random,
  exponentiate = F,
  include_p_direction = T) %>%
  print_df(rows_to_pack = rows_to_pack)
b l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS p_direction
Intercept 3.73* 3.52 3.94 1.001 4370.23 6385.35 1
Within-Person Effects
Daily persuasion experienced 0.00 -0.03 0.04 1.000 17939.10 9789.59 0.536
Daily persuasion utilized (partner’s view) 0.02 -0.02 0.06 1.000 16083.36 9736.51 0.792
Daily pressure experienced -0.05 -0.16 0.05 1.001 13407.68 8929.88 0.839
Daily pressure utilized (partner’s view) -0.04 -0.18 0.09 1.000 12032.49 8988.62 0.712
Daily pushing experienced 0.02 -0.04 0.09 1.001 14740.42 10175.51 0.761
Daily pushing utilized (partner’s view) 0.06* 0.01 0.12 1.000 15726.84 9585.61 0.983
Day 0.22* 0.06 0.38 1.000 23524.10 8669.26 0.996
Daily weartime NA NA NA NA NA NA NA
Between-Person Effects
Mean persuasion experienced 0.31 -0.26 0.89 1.001 3497.64 5376.58 0.859
Mean persuasion utilized (partner’s view) 0.23 -0.35 0.78 1.001 3509.40 5215.53 0.789
Mean pressure experienced -0.29 -0.88 0.30 1.001 4509.37 6827.12 0.833
Mean pressure utilized (partner’s view) -0.31 -0.89 0.28 1.001 4639.37 6766.96 0.849
Mean pushing experienced 0.25 -0.55 1.05 1.001 5563.03 7538.13 0.73
Mean pushing utilized (partner’s view) 0.38 -0.41 1.19 1.000 5684.30 7991.92 0.832
Mean weartime NA NA NA NA NA NA NA
Random Effects
sd(Intercept) 0.59 0.46 0.77 1.00 4200.42 6902.14 NA
sd(Daily persuasion experienced) 0.03 0.00 0.07 1.00 6399.64 7211.47 NA
sd(Daily persuasion utilized (partner’s view)) 0.06 0.01 0.11 1.00 3965.10 4144.64 NA
sd(Daily pressure experienced) 0.11 0.01 0.28 1.00 4670.61 6951.38 NA
sd(Daily pressure utilized (partner’s view)) 0.19 0.03 0.38 1.00 4325.92 4766.79 NA
sd(Daily pushing experienced) 0.09 0.02 0.17 1.00 5567.01 4535.34 NA
sd(Daily pushing utilized (partner’s view)) 0.05 0.00 0.13 1.00 5899.70 6469.91 NA
Additional Parameters
ar[1] 0.45 0.42 0.48 1.00 21354.19 8810.71 NA
ma[1] NA NA NA NA NA NA NA
cosy NA NA NA NA NA NA NA
nu NA NA NA NA NA NA NA
shape NA NA NA NA NA NA NA
sderr NA NA NA NA NA NA NA
sigma 0.87 0.85 0.89 1.00 21666.82 8355.30 NA

Reactance

range(df_double$reactance, na.rm = T) 
## [1] 0 5
hist(df_double$reactance, breaks = 18) 

hist(log(df_double$reactance+0.1), breaks = 10)

hist(df_double$reactance[df_double$reactance>0], breaks = 18)

Ordinal

df_double$reactance_ordinal <- factor(df_double$reactance,
                                      levels = 0:5, 
                                      ordered = TRUE)

formula <- bf(
  reactance_ordinal ~ 
    persuasion_self_cw + persuasion_partner_cw +
    pressure_self_cw + pressure_partner_cw +
    pushing_self_cw + pushing_partner_cw +
    
    persuasion_self_cb + persuasion_partner_cb +
    pressure_self_cb + pressure_partner_cb +
    pushing_self_cb + pushing_partner_cb +
    
    day +
    
    # Random effects
    (persuasion_self_cw + persuasion_partner_cw +
    pressure_self_cw + pressure_partner_cw +
    pushing_self_cw + pushing_partner_cw | coupleID)
  , autocor = autocor_str
)


prior1 <- c(
  brms::set_prior("normal(0, 2.5)", class = "b")
  #, brms::set_prior("normal(0, 10)", class = "Intercept", lb=0, ub=5) # range of the outcome scale
  
  , brms::set_prior("normal(0, 2)", class = "sd", group = "coupleID", lb = 0)
  
  #, brms::set_prior("cauchy(0, 2)", class = "sigma", lb = 0)
  , brms::set_prior("cauchy(0, 2)", class = "sderr", lb = 0)
  
  , autocor_prior
)


brms::validate_prior(
  prior1, 
  formula = formula, 
  data = df_double, 
  family = cumulative() # HURDLE_CUMULATIVE
  )
## Warning: Rows containing NAs were excluded from the model.
#df_minimal <- df_double[, c("AorB", all.vars(as.formula(formula)))]

reactance_ordinal <- my_brm(
  mi = use_mi, 
  imputed_data = implist,
  
  formula = formula, 
  prior = prior1,
  data = df_double, 
  family = brms::cumulative(),
  #control = list(adapt_delta = 0.95),
  iter = iterations,
  warmup = warmup,
  chains = 4,
  cores = 4,
  seed = 7777,
  file = file.path("models_cache_brms", paste0("reactance_ordinal_", suffix))
)
## Warning: Rows containing NAs were excluded from the model.
check_brms(reactance_ordinal)
## 
## Divergences:
## 0 of 12000 iterations ended with a divergence.
## 
## Tree depth:
## 0 of 12000 iterations saturated the maximum tree depth of 10.
## 
## Energy:
## E-BFMI indicated no pathological behavior.

## Using 10 posterior draws for ppc type 'ecdf_overlay' by default.

## Using 10 posterior draws for ppc type 'dens_overlay' by default.

## Warning: Found 5 observations with a pareto_k > 0.7 in model 'model'. We
## recommend to set 'moment_match = TRUE' in order to perform moment matching for
## problematic observations.
## 
## Computed from 12000 by 756 log-likelihood matrix.
## 
##          Estimate   SE
## elpd_loo   -683.4 32.1
## p_loo        92.7  6.2
## looic      1366.9 64.2
## ------
## MCSE of elpd_loo is NA.
## MCSE and ESS estimates assume MCMC draws (r_eff in [0.3, 1.4]).
## 
## Pareto k diagnostic values:
##                          Count Pct.    Min. ESS
## (-Inf, 0.7]   (good)     751   99.3%   187     
##    (0.7, 1]   (bad)        5    0.7%   <NA>    
##    (1, Inf)   (very bad)   0    0.0%   <NA>    
## See help('pareto-k-diagnostic') for details.
summarize_brms(
  reactance_ordinal, 
  model_rows_fixed = model_rows_fixed_ordinal,
  model_rows_random = model_rows_random_ordinal,
  model_rownames_fixed = model_rownames_fixed_ordinal,
  model_rownames_random = model_rownames_random_ordinal,
  exponentiate = T,
  include_p_direction = T) %>%
  print_df(rows_to_pack = rows_to_pack_ordinal)
OR l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS p_direction
Intercepts
Intercept NA NA NA NA NA NA NA
Intercept[1] 4.03* 2.37 7.11 1.000 5771.42 6583.42 1
Intercept[2] 8.94* 5.13 16.70 1.001 4147.38 5353.11 1
Intercept[3] 25.53* 13.66 52.08 1.001 3636.11 3983.04 1
Intercept[4] 115.36* 56.23 272.39 1.001 3285.34 3390.05 1
Intercept[5] 4344.29* 1212.85 21046.56 1.001 3595.34 3536.92 1
Within-Person Effects
Daily persuasion experienced 0.84* 0.71 0.99 1.001 8449.12 8008.36 0.98
Daily persuasion utilized (partner’s view) 1.02 0.83 1.25 1.000 8067.47 7409.36 0.6
Daily pressure experienced 1.87* 1.17 2.77 1.001 5678.61 6449.73 0.994
Daily pressure utilized (partner’s view) 1.24 0.72 2.10 1.000 7142.04 6035.51 0.812
Daily pushing experienced 1.17 0.96 1.45 1.000 6912.78 7372.54 0.944
Daily pushing utilized (partner’s view) 0.91 0.70 1.18 1.000 8461.27 8004.37 0.76
Day 1.48 0.73 2.98 1.000 12423.41 8896.43 0.864
Daily weartime NA NA NA NA NA NA NA
Between-Person Effects
Mean persuasion experienced 1.14 0.40 3.33 1.000 4035.93 5849.76 0.594
Mean persuasion utilized (partner’s view) 1.43 0.46 4.69 1.000 4047.45 6116.21 0.728
Mean pressure experienced 3.56* 1.16 11.26 1.000 4687.35 6068.94 0.986
Mean pressure utilized (partner’s view) 1.16 0.35 3.63 1.000 4389.44 6592.04 0.6
Mean pushing experienced 1.21 0.27 5.75 1.001 4930.89 7590.39 0.593
Mean pushing utilized (partner’s view) 0.10* 0.01 0.64 1.001 6509.30 7214.09 0.995
Mean weartime NA NA NA NA NA NA NA
Random Effects
sd(Intercept) 0.85 0.49 1.32 1.00 3877.68 5300.12 NA
sd(Daily persuasion experienced) 0.18 0.01 0.43 1.00 2038.71 4044.00 NA
sd(Daily persuasion utilized (partner’s view)) 0.22 0.01 0.52 1.00 3139.14 4498.36 NA
sd(Daily pressure experienced) 0.59 0.09 1.20 1.00 2757.85 2612.71 NA
sd(Daily pressure utilized (partner’s view)) 0.52 0.02 1.59 1.00 2807.86 4173.72 NA
sd(Daily pushing experienced) 0.22 0.01 0.53 1.00 3088.60 3994.39 NA
sd(Daily pushing utilized (partner’s view)) 0.19 0.01 0.62 1.00 4619.62 5640.25 NA
Additional Parameters
ar[1] 0.00 -0.92 0.94 1.00 3254.41 5617.26 NA
ma[1] NA NA NA NA NA NA NA
cosy NA NA NA NA NA NA NA
nu NA NA NA NA NA NA NA
shape NA NA NA NA NA NA NA
sderr 0.34 0.01 1.00 1.00 887.95 1136.18 NA
sigma NA NA NA NA NA NA NA
disc 1.00 1.00 1.00 NA NA NA NA
hypothesis(reactance_ordinal, "pressure_self_cw > pushing_self_cw")
## Hypothesis Tests for class b:
##                 Hypothesis Estimate Est.Error CI.Lower CI.Upper Evid.Ratio
## 1 (pressure_self_cw... > 0     0.47      0.25     0.03     0.85      22.81
##   Post.Prob Star
## 1      0.96    *
## ---
## 'CI': 90%-CI for one-sided and 95%-CI for two-sided hypotheses.
## '*': For one-sided hypotheses, the posterior probability exceeds 95%;
## for two-sided hypotheses, the value tested against lies outside the 95%-CI.
## Posterior probabilities of point hypotheses assume equal prior probabilities.

Binary

introduce_binary_reactance <- function(data) {
  data$is_reactance <- factor(data$reactance > 0, levels = c(FALSE, TRUE), labels = c(0, 1))
  return(data)
}



df_double <- introduce_binary_reactance(df_double)
if (use_mi) {
  for (i in seq_along(implist)) {
    implist[[i]] <- introduce_binary_reactance(implist[[i]])
  }
}


formula <- bf(
  is_reactance ~ 
    persuasion_self_cw + persuasion_partner_cw +
    pressure_self_cw + pressure_partner_cw +
    pushing_self_cw + pushing_partner_cw +
    
    persuasion_self_cb + persuasion_partner_cb +
    pressure_self_cb + pressure_partner_cb +
    pushing_self_cb + pushing_partner_cb +
    
    day +
    
    # Random effects
    (persuasion_self_cw + persuasion_partner_cw +
    pressure_self_cw + pressure_partner_cw +
    pushing_self_cw + pushing_partner_cw | coupleID)
  , autocor = autocor_str
  )



prior1 <- c(
  brms::set_prior("normal(0, 2.5)", class = "b")
  , brms::set_prior("normal(0, 10)", class = "Intercept", lb=0, ub=5) # range of the outcome scale
  
  , brms::set_prior("normal(0, 2)", class = "sd", group = "coupleID", lb = 0)
  
  #, brms::set_prior("cauchy(0, 2)", class = "sigma", lb = 0)
  #, brms::set_prior("cauchy(0, 2)", class = "sderr", lb = 0)
  
  , autocor_prior
)


brms::validate_prior(
  prior1, 
  formula = formula, 
  data = df_double, 
  family = bernoulli()
  )
## Warning: Rows containing NAs were excluded from the model.
#df_minimal <- df_double[, c("AorB", all.vars(as.formula(formula)))]

is_reactance <- my_brm(
  mi = use_mi, 
  imputed_data = implist,
  
  formula = formula, 
  prior = prior1,
  data = df_double, 
  family = brms::bernoulli(),
  #control = list(adapt_delta = 0.95, max_treedepth = 15),
  iter = iterations,
  warmup = warmup,
  chains = 4,
  cores = 4,
  seed = 7777,
  file = file.path("models_cache_brms", paste0("is_reactance_", suffix))
  #, file_refit = 'always'
)
## Warning: Rows containing NAs were excluded from the model.
check_brms(is_reactance)
## 
## Divergences:
## 0 of 12000 iterations ended with a divergence.
## 
## Tree depth:
## 0 of 12000 iterations saturated the maximum tree depth of 10.
## 
## Energy:
## E-BFMI indicated no pathological behavior.

## Using 10 posterior draws for ppc type 'ecdf_overlay' by default.

## Using 10 posterior draws for ppc type 'dens_overlay' by default.

## Warning: Found 721 observations with a pareto_k > 0.7 in model 'model'. We
## recommend to set 'moment_match = TRUE' in order to perform moment matching for
## problematic observations.
## 
## Computed from 12000 by 756 log-likelihood matrix.
## 
##          Estimate   SE
## elpd_loo   -328.4 12.7
## p_loo       260.2 10.7
## looic       656.8 25.5
## ------
## MCSE of elpd_loo is NA.
## MCSE and ESS estimates assume MCMC draws (r_eff in [0.6, 1.2]).
## 
## Pareto k diagnostic values:
##                          Count Pct.    Min. ESS
## (-Inf, 0.7]   (good)      35    4.6%   396     
##    (0.7, 1]   (bad)      572   75.7%   <NA>    
##    (1, Inf)   (very bad) 149   19.7%   <NA>    
## See help('pareto-k-diagnostic') for details.
DHARMa.check_brms.all(is_reactance, integer = FALSE)

## Object of Class DHARMa with simulated residuals based on 1000 simulations with refit = FALSE . See ?DHARMa::simulateResiduals for help. 
##  
## Scaled residual values: 0.1160033 0.457393 0.4852882 0.4772632 0.05895521 0.9779663 0.0640845 0.7148414 0.9686449 0.5012651 0.6509825 0.2305564 0.9945411 0.01570549 0.687121 0.633468 0.6006051 0.4089159 0.4803867 0.1582965 ...
summarize_brms(
  is_reactance, 
  model_rows_fixed = model_rows_fixed,
  model_rows_random = model_rows_random,
  model_rownames_fixed = model_rownames_fixed,
  model_rownames_random = model_rownames_random,
  exponentiate = T,
  include_p_direction = T) %>%
  print_df(rows_to_pack = rows_to_pack)
OR l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS p_direction
Intercept 0.03* 0.00 0.18 1.001 2961.20 5776.43 1
Within-Person Effects
Daily persuasion experienced 0.55 0.26 1.01 1.000 4130.22 6033.87 0.972
Daily persuasion utilized (partner’s view) 1.86 0.76 6.03 1.001 3737.98 5220.40 0.908
Daily pressure experienced 8.70* 1.69 60.77 1.000 3710.48 6299.81 0.995
Daily pressure utilized (partner’s view) 2.19 0.33 18.42 1.000 6729.25 6651.90 0.789
Daily pushing experienced 2.34* 1.07 6.63 1.000 3633.87 4827.24 0.983
Daily pushing utilized (partner’s view) 0.72 0.21 2.27 1.001 6444.05 6815.31 0.723
Day 3.78 0.38 43.96 1.000 6637.82 7554.77 0.871
Daily weartime NA NA NA NA NA NA NA
Between-Person Effects
Mean persuasion experienced 13.42 0.90 291.21 1.000 3985.43 6196.30 0.97
Mean persuasion utilized (partner’s view) 5.05 0.31 91.34 1.000 7444.78 7562.53 0.872
Mean pressure experienced 132.06* 3.62 5363.94 1.000 9338.38 8352.40 0.997
Mean pressure utilized (partner’s view) 6.03 0.15 270.01 1.000 8879.00 9243.83 0.824
Mean pushing experienced 4.47 0.10 220.19 1.000 7718.10 8220.27 0.781
Mean pushing utilized (partner’s view) 0.06 0.00 3.21 1.000 8490.07 8668.77 0.92
Mean weartime NA NA NA NA NA NA NA
Random Effects
sd(Intercept) 3.39 1.86 5.30 1.00 2132.54 3149.41 NA
sd(Daily persuasion experienced) 0.58 0.03 1.50 1.00 1978.49 4478.41 NA
sd(Daily persuasion utilized (partner’s view)) 1.50 0.42 2.95 1.00 2329.46 2696.99 NA
sd(Daily pressure experienced) 1.97 0.11 4.47 1.00 1972.68 3600.22 NA
sd(Daily pressure utilized (partner’s view)) 1.35 0.05 3.81 1.00 4817.26 5523.96 NA
sd(Daily pushing experienced) 0.84 0.05 2.02 1.00 2576.31 3993.09 NA
sd(Daily pushing utilized (partner’s view)) 0.75 0.03 2.23 1.00 4299.27 6263.29 NA
Additional Parameters
ar[1] 0.06 -0.16 0.27 1.00 1980.35 3211.48 NA
ma[1] NA NA NA NA NA NA NA
cosy NA NA NA NA NA NA NA
nu NA NA NA NA NA NA NA
shape NA NA NA NA NA NA NA
sderr 5.90 3.10 9.31 1.00 1442.76 1679.03 NA
sigma NA NA NA NA NA NA NA
hypothesis(is_reactance, "pressure_self_cw > pushing_self_cw")
## Hypothesis Tests for class b:
##                 Hypothesis Estimate Est.Error CI.Lower CI.Upper Evid.Ratio
## 1 (pressure_self_cw... > 0     1.31      0.99    -0.23     3.01      11.11
##   Post.Prob Star
## 1      0.92     
## ---
## 'CI': 90%-CI for one-sided and 95%-CI for two-sided hypotheses.
## '*': For one-sided hypotheses, the posterior probability exceeds 95%;
## for two-sided hypotheses, the value tested against lies outside the 95%-CI.
## Posterior probabilities of point hypotheses assume equal prior probabilities.

Report All Models

if (report_ordinal) {
  model_rows_random_final <- model_rows_random_ordinal
  model_rows_fixed_final <- model_rows_fixed_ordinal
  model_rownames_fixed_final <- model_rownames_fixed_ordinal
  model_rownames_random_final <- model_rownames_random_ordinal
  rows_to_pack_final <- rows_to_pack_ordinal
} else {
  model_rows_random_final <- model_rows_random_hu
  model_rows_fixed_final <- model_rows_fixed_hu
  model_rownames_fixed_final <- model_rownames_fixed_hu
  model_rownames_random_final <- model_rownames_random_hu
  rows_to_pack_final <- rows_to_pack_hu
}



all_models <- report_side_by_side(
  pa_sub,
  pa_obj_log,
  mood_gauss,
  reactance_ordinal,
  is_reactance,
  
  model_rows_random = model_rows_random_final,
  model_rows_fixed = model_rows_fixed_final,
  model_rownames_random = model_rownames_random_final,
  model_rownames_fixed = model_rownames_fixed_final
) 
## [1] "pa_sub"
## [1] "pa_obj_log"
## Warning in summarize_brms(model, short_version = TRUE, exponentiate =
## exponentiate, : Coefficients were exponentiated. Double check if this was
## intended.
## [1] "mood_gauss"
## [1] "reactance_ordinal"
## [1] "is_reactance"
# pretty printing
summary_all_models <- all_models %>%
  print_df(rows_to_pack = rows_to_pack_final) %>%
  add_header_above(
    c(" ", "Subjective MVPA Hurdle Poisson" = 2, 
      "Device-Based MVPA Log (Gaussian)" = 2, 
      "Mood Gaussian" = 2,
      "Reactance Ordinal" = 2,
      "Reactance Dichotome" = 2)
  )

export_xlsx(
  summary_all_models, 
  rows_to_pack = rows_to_pack_final,
  file.path("Output", "AllModels_experimental.xlsx"), 
  merge_option = 'both', 
  simplify_2nd_row = TRUE,
  colwidths = c(38, 7.2, 13.3, 7.2, 13.3,7.2, 13.3,7.2, 13.3,7.2, 13.3),
  line_above_rows = c(1,2),
  line_below_rows = c(-1)
)
## 
## Attaching package: 'rvest'
## The following object is masked from 'package:readr':
## 
##     guess_encoding
summary_all_models
Subjective MVPA Hurdle Poisson
Device-Based MVPA Log (Gaussian)
Mood Gaussian
Reactance Ordinal
Reactance Dichotome
b pa_sub 95% CI pa_sub exp(Est.) pa_obj_log 95% CI pa_obj_log b mood_gauss 95% CI mood_gauss OR reactance_ordinal 95% CI reactance_ordinal OR is_reactance 95% CI is_reactance
Intercept 3.89* [ 3.76, 4.01] 117.92* [105.70, 131.58] 3.73* [ 3.52, 3.94] NA NA 0.03* [0.00, 0.18]
Hurdle Intercept 0.18 [-0.15, 0.50] NA NA NA NA NA NA NA NA
Conditional Within-Person Effects
Daily persuasion experienced 0.03 [-0.02, 0.08] 1.03 [ 1.00, 1.06] 0.00 [-0.03, 0.04] 0.84* [0.71, 0.99] 0.55 [0.26, 1.01]
Daily persuasion utilized (partner’s view) 0.03 [-0.01, 0.08] 1.02 [ 0.99, 1.05] 0.02 [-0.02, 0.06] 1.02 [0.83, 1.25] 1.86 [0.76, 6.03]
Daily pressure experienced -0.10* [-0.20, -0.01] 0.95 [ 0.89, 1.01] -0.05 [-0.16, 0.05] 1.87* [1.17, 2.77] 8.70* [1.69, 60.77]
Daily pressure utilized (partner’s view) -0.07 [-0.16, 0.02] 0.98 [ 0.92, 1.04] -0.04 [-0.18, 0.09] 1.24 [0.72, 2.10] 2.19 [0.33, 18.42]
Daily pushing experienced 0.03 [-0.04, 0.10] 1.03 [ 0.98, 1.07] 0.02 [-0.04, 0.09] 1.17 [0.96, 1.45] 2.34* [1.07, 6.63]
Daily pushing utilized (partner’s view) -0.01 [-0.07, 0.06] 1.03 [ 0.99, 1.07] 0.06* [ 0.01, 0.12] 0.91 [0.70, 1.18] 0.72 [0.21, 2.27]
Day -0.02 [-0.15, 0.11] 0.96 [ 0.88, 1.05] 0.22* [ 0.06, 0.38] 1.48 [0.73, 2.98] 3.78 [0.38, 43.96]
Daily weartime NA NA 1.00* [ 1.00, 1.00] NA NA NA NA NA NA
Conditional Between-Person Effects
Mean persuasion experienced 0.03 [-0.29, 0.35] 1.09 [ 0.82, 1.45] 0.31 [-0.26, 0.89] 1.14 [0.40, 3.33] 13.42 [0.90, 291.21]
Mean persuasion utilized (partner’s view) 0.02 [-0.30, 0.33] 0.96 [ 0.71, 1.29] 0.23 [-0.35, 0.78] 1.43 [0.46, 4.69] 5.05 [0.31, 91.34]
Mean pressure experienced 0.09 [-0.29, 0.45] 0.97 [ 0.71, 1.34] -0.29 [-0.88, 0.30] 3.56* [1.16, 11.26] 132.06* [3.62, 5363.94]
Mean pressure utilized (partner’s view) -0.12 [-0.50, 0.27] 0.98 [ 0.72, 1.33] -0.31 [-0.89, 0.28] 1.16 [0.35, 3.63] 6.03 [0.15, 270.01]
Mean pushing experienced 0.27 [-0.20, 0.75] 1.01 [ 0.66, 1.54] 0.25 [-0.55, 1.05] 1.21 [0.27, 5.75] 4.47 [0.10, 220.19]
Mean pushing utilized (partner’s view) 0.27 [-0.21, 0.76] 1.29 [ 0.85, 1.96] 0.38 [-0.41, 1.19] 0.10* [0.01, 0.64] 0.06 [0.00, 3.21]
Mean weartime NA NA 1.00 [ 1.00, 1.00] NA NA NA NA NA NA
Hurdle Within-Person Effects
Hu Daily persuasion experienced -0.43* [-0.56, -0.31] NA NA NA NA NA NA NA NA
Hu Daily persuasion utilized (partner’s view) -0.28* [-0.40, -0.17] NA NA NA NA NA NA NA NA
Hu Daily pressure experienced 0.21 [-0.12, 0.54] NA NA NA NA NA NA NA NA
Hu Daily pressure utilized (partner’s view) -0.41* [-0.86, -0.05] NA NA NA NA NA NA NA NA
Hu Daily pushing experienced -0.55* [-0.92, -0.24] NA NA NA NA NA NA NA NA
Hu Daily pushing utilized (partner’s view) -0.62* [-0.89, -0.39] NA NA NA NA NA NA NA NA
Hu Day 0.09 [-0.17, 0.35] NA NA NA NA NA NA NA NA
Hu Daily weartime NA NA NA NA NA NA NA NA NA NA
Hurdle Between-Person Effects
Hu Mean persuasion experienced -0.19 [-1.05, 0.67] NA NA NA NA NA NA NA NA
Hu Mean persuasion utilized (partner’s view) -0.18 [-1.02, 0.67] NA NA NA NA NA NA NA NA
Hu Mean pressure experienced 1.25* [ 0.33, 2.16] NA NA NA NA NA NA NA NA
Hu Mean pressure utilized (partner’s view) 0.61 [-0.30, 1.51] NA NA NA NA NA NA NA NA
Hu Mean pushing experienced -1.14 [-2.36, 0.09] NA NA NA NA NA NA NA NA
Hu Mean pushing utilized (partner’s view) -1.16 [-2.39, 0.08] NA NA NA NA NA NA NA NA
Hu Mean weartime NA NA NA NA NA NA NA NA NA NA
Random Effects
sd(Intercept) 0.31 [0.24, 0.41] 0.30 [0.23, 0.39] 0.59 [0.46, 0.77] 0.85 [ 0.49, 1.32] 3.39 [ 1.86, 5.30]
sd(Hurdle Intercept) 0.90 [0.70, 1.17] NA NA NA NA NA NA NA NA
sd(Daily persuasion experienced) 0.11 [0.07, 0.16] 0.05 [0.03, 0.08] 0.03 [0.00, 0.07] 0.18 [ 0.01, 0.43] 0.58 [ 0.03, 1.50]
sd(Daily persuasion utilized (partner’s view)) 0.08 [0.04, 0.13] 0.05 [0.02, 0.08] 0.06 [0.01, 0.11] 0.22 [ 0.01, 0.52] 1.50 [ 0.42, 2.95]
sd(Daily pressure experienced) 0.06 [0.00, 0.20] 0.04 [0.00, 0.13] 0.11 [0.01, 0.28] 0.59 [ 0.09, 1.20] 1.97 [ 0.11, 4.47]
sd(Daily pressure utilized (partner’s view)) 0.06 [0.00, 0.18] 0.04 [0.00, 0.11] 0.19 [0.03, 0.38] 0.52 [ 0.02, 1.59] 1.35 [ 0.05, 3.81]
sd(Daily pushing experienced) 0.12 [0.06, 0.20] 0.06 [0.00, 0.14] 0.09 [0.02, 0.17] 0.22 [ 0.01, 0.53] 0.84 [ 0.05, 2.02]
sd(Daily pushing utilized (partner’s view)) 0.11 [0.04, 0.18] 0.03 [0.00, 0.08] 0.05 [0.00, 0.13] 0.19 [ 0.01, 0.62] 0.75 [ 0.03, 2.23]
sd(Hu Daily persuasion experienced) 0.18 [0.02, 0.34] NA NA NA NA NA NA NA NA
sd(Hu Daily persuasion utilized (partner’s view)) 0.17 [0.02, 0.33] NA NA NA NA NA NA NA NA
sd(Hu Daily pressure experienced) 0.30 [0.01, 0.85] NA NA NA NA NA NA NA NA
sd(Hu Daily pressure utilized (partner’s view)) 0.35 [0.01, 1.02] NA NA NA NA NA NA NA NA
sd(Hu Daily pushing experienced) 0.65 [0.33, 1.08] NA NA NA NA NA NA NA NA
sd(Hu Daily pushing utilized (partner’s view)) 0.32 [0.05, 0.65] NA NA NA NA NA NA NA NA
Additional Parameters
ar[1] 0.35 [0.27, 0.42] 0.29 [0.26, 0.33] 0.45 [0.42, 0.48] 0.00 [-0.92, 0.94] 0.06 [-0.16, 0.27]
ma[1] NA NA NA NA NA NA NA NA NA NA
cosy NA NA NA NA NA NA NA NA NA NA
nu NA NA NA NA NA NA NA NA NA NA
shape NA NA NA NA NA NA NA NA NA NA
sderr 0.62 [0.60, 0.65] NA NA NA NA 0.34 [ 0.01, 1.00] 5.90 [ 3.10, 9.31]
sigma NA NA 0.55 [0.54, 0.57] 0.87 [0.85, 0.89] NA NA NA NA
report::report_system()

Analyses were conducted using the R Statistical language (version 4.4.1; R Core Team, 2024) on Windows 11 x64 (build 22635)

report::report_packages()
  • beepr (version 2.0; Bååth R, 2024)
  • R.methodsS3 (version 1.8.2; Bengtsson H, 2003)
  • R.oo (version 1.26.0; Bengtsson H, 2003)
  • R.utils (version 2.12.3; Bengtsson H, 2023)
  • brms (version 2.21.0; Bürkner P, 2017)
  • Rcpp (version 1.0.13; Eddelbuettel D et al., 2024)
  • bayesplot (version 1.11.1; Gabry J, Mahr T, 2024)
  • lubridate (version 1.9.3; Grolemund G, Wickham H, 2011)
  • DHARMa (version 0.4.6; Hartig F, 2022)
  • wbCorr (version 0.1.22; Küng P, 2023)
  • tibble (version 3.2.1; Müller K, Wickham H, 2023)
  • R (version 4.4.1; R Core Team, 2024)
  • openxlsx (version 4.2.7.1; Schauberger P, Walker A, 2024)
  • ggplot2 (version 3.5.1; Wickham H, 2016)
  • forcats (version 1.0.0; Wickham H, 2023)
  • stringr (version 1.5.1; Wickham H, 2023)
  • rvest (version 1.0.4; Wickham H, 2024)
  • tidyverse (version 2.0.0; Wickham H et al., 2019)
  • readxl (version 1.4.3; Wickham H, Bryan J, 2023)
  • dplyr (version 1.1.4; Wickham H et al., 2023)
  • purrr (version 1.0.2; Wickham H, Henry L, 2023)
  • readr (version 2.1.5; Wickham H et al., 2024)
  • xml2 (version 1.3.6; Wickham H et al., 2023)
  • tidyr (version 1.3.1; Wickham H et al., 2024)
  • knitr (version 1.48; Xie Y, 2024)
  • kableExtra (version 1.4.0; Zhu H, 2024)
report::cite_packages()